package com.dlb.andorid.presenter;

import com.dlb.andorid.XAPI;
import com.dlb.andorid.XContract;
import com.dlb.andorid.XPresenter;
import com.dlb.andorid.XServerMsg;
import com.dlb.andorid.bean.Coupon;

import java.util.HashMap;
import java.util.List;

public class CouponPresenter extends XPresenter {

	XContract.ICouponView iView;

	public CouponPresenter(XContract.ICouponView iView) {
		super(iView);
		this.iView = iView;
	}

	public void getCouponList(){
		mModel.getCouponList();
	}

	@Override
	public void onDataSuccess(int vocational_id, HashMap<String, Object> exData, Object data) {
		super.onDataSuccess(vocational_id, exData, data);

		switch (vocational_id){
			case XAPI.GET_COUPON_LIST_VOCATIONAL_ID:
				iView.getCouponListSuccess(((XServerMsg<List<Coupon>>)data).getData());
				break;
		}
	}
}
